﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "IEventArgs.h"
#include "ElementId.h"


namespace gcmp
{
    class IDocument;
    class Vector3d;

    /// \brief 视口事件类型
    ///
    /// 
    enum class DrawingViewportEventType : int32_t
    {
        Created = 0,        ///< 视口创建
        Changed = 1,        ///< 视口位置或者大小改变(非多边形视口)
        PreDelete = 2,      ///< 视口预删除
        Activated = 3,      ///< 视口激活
        Deactivated = 4,    ///< 视口反激活
        PolygonChanged = 7, ///< 视口多边形发生改变(包含多边形视口位置或大小改变引起的多边形位置或形状改变)
    };


    /// \brief  文档事件参数
    ///
    class GCMP_MODEL_INTERFACE_EXPORT IDrawingViewportEventArgs : public IEventArgs
    {
        DEFINE_CAST_DERIVED(gcmp::IDrawingViewportEventArgs, gcmp::IEventArgs)
    public:
        ///  \brief 获取视口事件类型
        ///
        /// \return 视口事件类型
        virtual DrawingViewportEventType GetType() const = 0;

        ///  \brief 获取视口事件对应的文档
        ///
        /// \return 视口文档指针
        virtual const IDocument* GetDocument() const = 0;

        ///  \brief 获取视口事件对应的视图Id
        ///
        /// \return 视图Id
        virtual ElementId GetModelViewId() const = 0;

        ///  \brief 获取视口事件对应的视口ElementId
        ///
        /// \return 视口ElementId
        virtual ElementId GetViewportId() const = 0;


        ///  \brief 获取视口范围
        /// \param leftBottomPoint  视口左下（相对于图纸）角点世界坐标
        /// \param rightUpPoint     视口右上（相对于图纸）角点世界坐标
        /// \return 
        virtual void GetViewport(Vector3d& leftBottomPoint, Vector3d& rightUpPoint) const = 0;
    };
}
